{
	template:`
    <m-page @back="back" title="商家信息">
        <template #bar>
            <div class="flex-sub flex flex-direction padding-lr">
                <m-button @click="save">保存</m-button>
            </div>
        </template>
        <m-top></m-top>
        <m-title>商家信息</m-title>
        <m-card>
            <div class="cu-form-group">
                <div class="title text-red">商家名称</div>
                <m-input v-model="model.name" placeholder="请输入商家名称"></m-input>
            </div>
            <div class="cu-form-group">
                <div class="title text-red">商家描述</div>
                <m-input type="textarea" v-model="model.description" placeholder="请输入商家描述"></m-input>
            </div>
        </m-card>
        <m-title>会员日设置</m-title>
        <m-card>
            <div class="cu-form-group">
                <div class="title text-red">会员日类型</div>
                <m-dict-option class="flex-sub" v-model="model.memberDayType" type="member.base.model.BusinessInfo!memberDayType"></m-dict-option>
            </div>
            <div v-if="model.memberDayType=='N'" class="cu-form-group text-red">
                当前未设置会员日！
            </div>
            <div v-if="model.memberDayType=='A'" class="cu-form-group">
                <m-dict-option class="flex-sub" v-model="model.memberDayNo" multiple type="member.base.model.BusinessInfo!memberDayNo"></m-dict-option>
            </div>
            <div v-if="model.memberDayType=='B'" class="cu-form-group">
                <m-dict-option class="flex-sub" v-model="model.memberWeekNo" type="member.base.model.BusinessInfo!memberWeekNo"></m-dict-option>
            </div>
            <div v-if="model.memberDayType!='N'" class="cu-form-group">
                <div class="title text-red">积分倍数</div>
                <m-input-number v-model="model.pointRate" placeholder="请输入积分倍数（100~500）" format="#,##0"></m-input-number>
                <div>%</div>
            </div>
            <div v-if="model.memberDayType!='N'" class="cu-form-group text-placeholder">
                （范围可设置100~500），例如：会员日消费66.6元，非会员日积分+66，会员日翻倍后{{formatNumber(66*model.pointRate/100,"0")}}。
            </div>
            <div v-if="model.memberDayType!='N'" class="cu-form-group">
                <div class="title text-red">优惠比例</div>
                <m-input-number v-model="model.discount" placeholder="请输入优惠比例（0~100）" format="#,##0"></m-input-number>
                <div>%</div>
            </div>
            <div v-if="model.memberDayType!='N'" class="cu-form-group text-placeholder">
                （范围可设置0~100），例如：会员日订单最终金额88.8元，会员日只需{{formatNumber(88.8*(100-model.discount)/100,"0.00")}}元。
            </div>
        </m-card>
    </m-page>
	`,
	props: ['param','parentVue'],
	data:function(){
		return {
		    model:{}
		};
	},
	mounted(){
	    this.loadModel();
	},
	methods:{
	    loadModel:function(){
            this.requestData('action/base/businessInfo/get',
                {},
                (data)=>{
                    if(data.code==0){
                        this.model=data.model;
                    }else{
                        this.remind().error(data.msg);
                        this.back();
                    }
                }
            );
	    },
        save:function(){
            this.requestData('action/base/businessInfo/save',
                {model:this.model},
                (data)=>{
                    if(data.code==0){
                        this.remind().success(data.msg);
                        this.back(true);
                    }else{
                        this.remind().error(data.msg);
                    }
                }
            );
        },
	}
}